<?php /*a:3:{s:67:"D:\laragon\www\ssbeautiful\application\manage\view\columns_add.html";i:1540951044;s:60:"D:\laragon\www\ssbeautiful\application\manage\view\base.html";i:1596192950;s:69:"D:\laragon\www\ssbeautiful\application\manage\view\public_upload.html";i:1591401853;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>cms</span>
            <span class="icon-angle-right"></span>
            <span>管理栏目</span>
            <span class="icon-angle-right"></span>
            <span>栏目管理</span>
            <span class="icon-angle-right"></span>
            <span><?php echo !empty($info) ? '编辑'  :  '添加'; ?>栏目</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-tab-tit clearfix">
                <ul>
                    <li class="item-act"><a href="javascript:;">基本属性</a></li>
                    <li><a href="javascript:;">选项设置</a></li>
                </ul>
            </div>
            <div class="m-form mt-10">
                <form class="layui-form" id="j_form">
                    <div class="m-tab-con">
                        <table class="m-table">
                            <thead>
                                <tr>
                                    <th colspan="2">基本属性</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td width="15%"><label for="name">栏目名称<em>*</em></label></td>
                                    <td><input type="text" class="u-ipt u-ipt-long" name="name" id="name" placeholder="请输入栏目名称" value="<?php echo htmlentities($info['name']); ?>" /></td>
                                </tr>
                                <tr>
                                    <td><label for="alias_name">栏目别名</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-long" name="alias_name" id="alias_name" placeholder="请输入栏目别名" value="<?php echo htmlentities($info['alias_name']); ?>" /></td>
                                </tr>
                                <tr>
                                    <td><label for="">父级栏目</label></td>
                                    <td>
                                        <div class="lay-select m-select-def">
                                            <select name="parent_id">
                                                <option value="0">根栏目</option>
                                                <?php if(is_array($columns) || $columns instanceof \think\Collection || $columns instanceof \think\Paginator): if( count($columns)==0 ) : echo "" ;else: foreach($columns as $key=>$v): ?>
                                                <option value="<?php echo htmlentities($v['id']); ?>"<?php if($v['is_last']): ?> disabled<?php endif; if($info['parent_id'] == $v['id']): ?> selected<?php endif; ?>><?php echo htmlentities(html_entity_decode($v['html'])); ?>|-<?php echo htmlentities($v['name']); ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td><label for="">所属系统模型<em>*</em></label></td>
                                    <td>
                                        <div class="lay-select m-select-def">
                                            <select name="mod_id">
                                                <option value="0">请选择系统模型</option>
                                                <?php if(is_array($mods) || $mods instanceof \think\Collection || $mods instanceof \think\Paginator): if( count($mods)==0 ) : echo "" ;else: foreach($mods as $key=>$mod): ?>
                                                <option value="<?php echo htmlentities($mod['id']); ?>"<?php if($info['mod_id'] == $mod['id']): ?> selected<?php endif; ?>><?php echo htmlentities($mod['name']); ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td><label for="">是否终极栏目</label></td>
                                    <td>
                                        <input type="radio" name="is_last" value="1" title="是"<?php if(!$info || $info['is_last'] == 1): ?> checked<?php endif; ?> />
                                        <input type="radio" name="is_last" value="0" title="否"<?php if($info && $info['is_last'] == 0): ?> checked<?php endif; ?> />
                                    </td>
                                </tr>
                                <tr>
                                    <td><label for="">栏目缩略图</label></td>
                                    <td>
                                        <button type="button" class="layui-btn u-upload-pic" data-name="image_id"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                                        <div class="m-pic">
                                            <ul>
                                                <?php echo attach_html($info['image_id'], 'image_id'); ?>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td><label for="keywords">栏目关键词</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-long" name="keywords" id="keywords" placeholder="请输入栏目关键词" value="<?php echo htmlentities($info['keywords']); ?>" /></td>
                                </tr>
                                <tr>
                                    <td><label for="intro">栏目简介</label></td>
                                    <td><div class="m-textarea"><textarea name="intro" class="u-tarea" id="intro" placeholder="请输入栏目简介"><?php echo htmlentities($info['intro']); ?></textarea></div></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="m-tab-con dn">
                        <table class="m-table">
                            <thead>
                                <tr>
                                    <th colspan="2">选项设置</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td width="15%"><label for="">栏目访问权限</label></td>
                                    <td><div class="lay-checked"><?php if(is_array($roles) || $roles instanceof \think\Collection || $roles instanceof \think\Paginator): if( count($roles)==0 ) : echo "" ;else: foreach($roles as $key=>$role): ?><input type="checkbox" name="access_role_ids[]" value="<?php echo htmlentities($role['id']); ?>" title="<?php echo htmlentities($role['name']); ?>" lay-skin="primary"<?php if(strpos(','.$info['access_role_ids'].',', ','.$role['id'].',') !== false): ?> checked<?php endif; ?> /><?php endforeach; endif; else: echo "" ;endif; ?></div></td>
                                </tr>
                                <tr>
                                    <td width="15%"><label for="">栏目下信息是否允许评论</label></td>
                                    <td><div class="lay-checked"><input type="checkbox" name="is_comment" value="1" title="允许" lay-skin="primary"<?php echo !empty($info['is_comment']) ? ' checked'  :  ''; ?> /></div></td>
                                </tr>
                                <tr>
                                    <td width="15%"><label for="">评论是否需要审核</label></td>
                                    <td><div class="lay-checked"><input type="checkbox" name="is_comment_checked" value="1" title="需要" lay-skin="primary"<?php echo !empty($info['is_comment_checked']) ? ' checked'  :  ''; ?> /></div></td>
                                </tr>
                                <tr>
                                    <td width="15%"><label for="">栏目是否允许投稿</label></td>
                                    <td><div class="lay-checked"><input type="checkbox" name="is_post" value="1" title="允许" lay-skin="primary"<?php echo !empty($info['is_post']) ? ' checked'  :  ''; ?> /></div></td>
                                </tr>
                                <tr>
                                    <td width="15%"><label for="">投稿是否需要审核</label></td>
                                    <td><div class="lay-checked"><input type="checkbox" name="is_post_checked" value="1" title="需要" lay-skin="primary"<?php echo !empty($info['is_post_checked']) ? ' checked'  :  ''; ?> /></div></td>
                                </tr>
                                <tr>
                                    <td width="15%"><label for="">投稿权限</label></td>
                                    <td><div class="lay-checked"><?php if(is_array($roles) || $roles instanceof \think\Collection || $roles instanceof \think\Paginator): if( count($roles)==0 ) : echo "" ;else: foreach($roles as $key=>$role): ?><input type="checkbox" name="post_role_ids[]" value="<?php echo htmlentities($role['id']); ?>" title="<?php echo htmlentities($role['name']); ?>" lay-skin="primary"<?php if(strpos(','.$info['post_role_ids'].',', ','.$role['id'].',') !== false): ?> checked<?php endif; ?> /><?php endforeach; endif; else: echo "" ;endif; ?></div></td>
                                </tr>
                                <tr>
                                    <td><label for="qinfo_page">前台信息每页显示</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-small" name="qinfo_page" id="qinfo_page" value="<?php echo !empty($info['qinfo_page']) ? htmlentities($info['qinfo_page']) : config('site.default_home_limit'); ?>" /><span>条记录</span></td>
                                </tr>
                                <tr>
                                    <td><label for="diy_browse_nums">栏目自定义访问量</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-small" name="diy_browse_nums" id="diy_browse_nums" value="<?php echo !empty($info['diy_browse_nums']) ? htmlentities($info['diy_browse_nums']) : 0; ?>" /></td>
                                </tr>
                                <tr>
                                    <td><label for="actual_browse_nums">栏目实际访问量</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-small" name="actual_browse_nums" id="actual_browse_nums" value="<?php echo !empty($info['actual_browse_nums']) ? htmlentities($info['actual_browse_nums']) : 0; ?>" readonly /><span>实际浏览量不可修改，只可查看。</span></td>
                                </tr>
                                <tr>
                                    <td><label for="list_order">排序</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-tiny" name="list_order" id="list_order" placeholder="请输入排序值" value="<?php echo !empty($info['list_order']) ? htmlentities($info['list_order']) : 0; ?>" /><span>值越大越排在前面</span></td>
                                </tr>
                                <tr>
                                    <td><label for="">选择模板</label></td>
                                    <td>
                                        <div class="lay-select m-select-longer">
                                            <select name="template">
                                                <option value="columns_index">默认栏目模板 - columns_index.html</option>
                                            </select>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="m-form-btn"><input type="hidden" name="origin_super_column_ids" value="<?php echo htmlentities($info['super_column_ids']); ?>" /><input type="hidden" name="origin_sub_column_ids" value="<?php echo htmlentities($info['sub_column_ids']); ?>" /><input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script>

    /**

     * 上传图片

     * @param  {object}  uploader upload 对象

     * @param  {string}  ele      容器选择器

     * @param  {boolean} multiple 是否允许多图上传

     */

    function upload_pic(uploader, ele, multiple)

    {

        var signature = setSign();

        uploader.render({

            elem: ele,

            field: 'imgFile',

            multiple: multiple,

            url: '<?php echo url("/manage/upload/upload", ["path" => session("userid", "", session_prefix()), "type" => "image", "module" => request()->module() ?: "addons"]); ?>',

            headers: {signature: signature},

            done: function(ret){

                var index = dialog.loading();

                if (ret.status == 0) {

                    var name = $(this.item).attr('data-name');

                    // 上传完毕回调

                    if (multiple) {

                        // 上传多图
                        $(this.item).parent().find('.m-pics ul').append('<li><img src="' + ret.data.attach_uri + '" alt="" /><input type="hidden" name="' + name + '[desc][]" value="' + ret.data.id + '" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');
                    } else {

                        // 上传单图

                        $(this.item).parent().find('.m-pic ul').html('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '" value="' + ret.data.id + '" /></li>');

                    }

                    layer.close(index);

                } else {

                    dialog.error(ret.message);

                    layer.close(index);
                }
            }
        })
    }


    /**
     * 上传图片
     * @param  {object}  uploader upload 对象
     * @param  {string}  ele      容器选择器
     * @param  {boolean} multiple 是否允许多图上传
     */
    function sxupload_pic(uploader, ele, multiple)
    {
        var signature = setSign();
        uploader.render({
            elem: ele,
            field: 'imgFile',
            multiple: multiple,
            url: '<?php echo url("api/v1/upload", ["path" => session("userid", "", session_prefix()), "type" => "image", "module" => request()->module() ?: "addons"]); ?>',
            headers: {signature: signature},
            done: function(ret){
                var index = dialog.loading();
                if (ret.status == 0) {
                    var name = $(this.item).attr('data-name');
                    // 上传完毕回调
                    if (multiple) {
                        // 上传多图
                        $(this.item).parent().find('.m-pics ul').append('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');
                    } else {
                        // 上传单图
                        $(this.item).parent().find('.m-pic ul').html('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '" value="' + ret.data.id + '" /></li>');
                    }
                    layer.close(index);
                } else {
                    dialog.error(ret.message);

                    layer.close(index);
                }

            }

        })

    }



    /**

     * 上传附件

     * @param  {object}  uploader upload 对象

     * @param  {string}  ele      容器选择器

     */

    function upload_file(uploader, ele)

    {

        uploader.render({

            elem: ele,

            field: 'imgFile',

            accept: 'file',

            url: '<?php echo url("manage/upload/filemanager", ["path" => session("userid", "", session_prefix()), "type" => "file", "module" => request()->module() ?: "addons"]); ?>',

            done: function(ret){

                var index = dialog.loading();

                if (ret.status == 0) {

                    var name = $(this.item).attr('data-name');

                    // 上传完毕回调

                    $(this.item).parent().find('.m-files ul').append('<li><i class="icon-paper-clip"></i><input type="text" name="'+name+'[name][]" value="' + ret.data.title + '" /><a data-md5-file="' + ret.data.md5_file + '" data-id="' + ret.data.id + '" class="u-download">下载</a><a class="u-item" data-id="' + ret.data.id + '">删除</a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');

                    $(this.item).parent().find('.m-files').show();

                    layer.close(index);

                } else {

                	

                    dialog.error(ret.message);



                    layer.close(index);

                }

            }

        })

    }



    layui.use(['upload'], function(ele, multiple){

        // 得到 upload 对象

        var upload = layui.upload;

        // 上传单图

        upload_pic(upload, '.u-upload-pic', false);

        // 上传多图

        upload_pic(upload, '.u-upload-pics', true);

        // 上传附件

        upload_file(upload, '.u-upload-file');

        //双喜
        sxupload_pic(upload, '.sxu-upload-pic', false);
        sxupload_pic(upload, '.sxu-upload-pics', true);
    });

</script>

</body>
</html>